/**
 * 
 */
package com.kim.rssreader.utils.proxy;

/**
 * 代理网关获取代理
 * 
 * @author duminghui
 * 
 */
public class NetProxyInfoProxy {
	private final static NetProxyInfoProxy instance = new NetProxyInfoProxy();
	private ANetProxyInfoFactory factory;

	private NetProxyInfoProxy() {

	}

	public final static NetProxyInfoProxy getInstance() {
		return instance;
	}

	public final void setNetProxyInfoFactory(ANetProxyInfoFactory factory) {
		this.factory = factory;
	}

	public final NetProxyInfo getNetProxyInfo() {

		// 获取默认代理主机ip
		String host = android.net.Proxy.getDefaultHost();
		// 获取端口
		int port = android.net.Proxy.getDefaultPort();
		if (host != null && port != -1) {
			NetProxyInfo info = new NetProxyInfo();
			info.port = port;
			info.host = host;

			return info;
		}
		return null;
	}
}
